# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=tcpxtract
pkgver=1.0.1
pkgrel=6
pkgdesc='A tool for extracting files from network traffic.'
url='http://tcpxtract.sourceforge.net'
depends=('libpcap' 'flex')
license=('GPL')
groups=('blackarch' 'blackarch-misc')
arch=('x86_64' 'aarch64')
source=("http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz"
        'conf_default_path.patch')
sha512sums=('30c8bb7db09121889cd5a3e359deb494503038b4c6ea8dd12d397c9215693cf9a97a21a8d0c1331cdad8f1139c17a4ff75b800b7508ad32ec705cb8547640337'
            '171129cd71a86b115f22a6f7d4c8c7daefb153d0fda175e35e45916f0d9a257cdbfdd4f72ef8bb0a27bf9ff314cd0675f1934370326964ecb9a45f956d6f81bc')

prepare(){
  cd "$pkgname-$pkgver"

  patch -Np0 -i "$srcdir/conf_default_path.patch"
}

build() {
  cd "$pkgname-$pkgver"

  if [[ "$CARCH" == "i686" || "$CARCH" == "x86_64" ]];
  then
    ./configure --prefix=/usr --sysconfdir=/etc
  else
    ./configure --build=arm --prefix=/usr --sysconfdir=/etc
  fi

  make
}

package() {
  cd "$pkgname-$pkgver"

  install -dm 755 "$pkgdir/usr/share"

  make DESTDIR="$pkgdir" install

  mv "$pkgdir/usr/man" "$pkgdir/usr/share/"
}

